const config=require("../../utils/config.js");

Page({
  data: {
    focus:[
      {
        id:1,
        pic:'/pages/images/timg.jfif'
      },
      {
        id:2,
        pic:'/pages/images/timg (1).jfif'
      },
      {
        id:3,
        pic:'/pages/images/timg (2).jfif'
      },
      {
        id:4,
        pic:'/pages/images/timg (3).jfif'
      }
    ],     
    list:[]
  },
  onLoad:function(){
    wx.request({
      url: config.data+'/articles',
      header: {
        "Content-Type": "json"
      },
      method:"GET",
      dataType:"json",
      success:(res)=>{
        // console.log(res);
        this.setData({
          list: res.data.data
        })
      }
    })
  },
  showDetail:function(event){
    var id=event.target.dataset.id;
    wx.navigateTo({
      url:'/pages/detail/detail?id='+id,
    })
  }
 
})
